# -*- coding: utf-8 -*-
"""
-------------------------------------------------
   File Name：     day158_pyqt5_qCombox
   Description :
   Author :       fuml
   date：          2019/9/23
-------------------------------------------------
   Change Activity:
                   2019/9/23:
-------------------------------------------------
"""
import sys
from PyQt5.QtWidgets import QWidget,QComboBox,QLabel,QApplication,\
            QVBoxLayout
class Example(QWidget):
    def __init__(self):
        super().__init__()
        self.initUI()

    def initUI(self):
        cbx = QComboBox(self)
        cbx.addItem("Ubuntu")
        cbx.addItem("Mandriva")
        cbx.addItem("Fedora")
        cbx.addItem("Arch")
        cbx.addItem("Gentoo")
        cbx.setCurrentIndex(0)
        self.lbl = QLabel(self)
        self.lbl.setText(cbx.currentText())
        cbx.activated[str].connect(self.onActivate)
        cbx.move(50, 50)
        self.lbl.move(50, 150)

        self.setGeometry(300, 300, 250, 180)
        self.setWindowTitle('Combox')
        self.show()

    def onActivate(self,text):
        self.lbl.setText(text)
        self.lbl.adjustSize()

if __name__ == '__main__':
    app =QApplication(sys.argv)
    ex =Example()
    sys.exit(app.exec_())